/*
 * Event manipulations header file
 *
 * Copyright (C) 2020 Long-Horn.
 *
 */
#ifndef EVENT_H
#define EVENT_H

#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>

#ifdef __cplusplus
extern "C"  {
#endif

#define PAYLOAD_LEN_MAX 128

typedef struct _event_s {
    int priority;
    int from;
    int to;
    size_t payload_len;
    uint8_t payload[PAYLOAD_LEN_MAX];
} event_s;

typedef struct _event_callback {
    void (* callback)(void *event);
} event_callback_s;

int event_wrap_data(event_s *event, void *buf, int count);
int event_parse_data(event_s *event, void *buf, int count);
int event_make_response(event_s *event, void *response, int count);

#ifdef __cplusplus
}
#endif

#endif	/* EVENT_H */
